<?php
include_once("../../_inc/config.php");
include_once("../../_class/db.php");
header('Content-type:text/javascript;charset=UTF-8');
session_start();
$sql = new db();
$json = json_decode(stripslashes($_POST["_gt_json"]));
$idcom = $json->{'parameters'}->{'idcom'};
$req = "SELECT p.Id_palette, p.Id_ordre_preparation, Emplacement FROM colis AS co, ligne_commande AS li, preparation AS pr, palette AS p WHERE li.Id_Commande =".$idcom." AND li.Id_Commande = pr.Id_Commande AND pr.Id_ordre_preparation = p.Id_Ordre_preparation AND p.Id_palette = co.Id_palette GROUP BY p.Id_palette";
$sql->query($req);
$retArray = array();
while ($row = $sql->fetch_row()) 
	{
		$row[0] = "<a href='".ABS_PATH.ROOT."?page=Entrepot/ShowCom&fct=Entrepot/ShowCom&idcom=".$idcom."&idpal=".$row[0]."'>".$row[0]."</a>";
		$retArray[] = $row;
	}
$data = json_encode($retArray);
$ret = "{data:" . $data .",\n";
$ret .= "recordType : 'array'}";
echo $ret;
?>